package arocms.util;

public class FileSizeFormatter {
    
    public FileSizeFormatter() {
    }
    
    private static final int TRESHOLD = 3*1024;
    
    public static String auto(int fsize) {
        if (fsize < TRESHOLD) {
            return String.valueOf(fsize) + "B";
        } else {
            fsize = fsize/1024;
            if (fsize < TRESHOLD) {
                return String.valueOf(fsize) + "kB";
            } else {
                fsize=fsize/1024;
                return String.valueOf(fsize) + "MB";
            }
        }
    }
    
}
